package actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.RowSet;

import model.StudentDBModel;
import data.*;

import java.util.Vector;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class Chairs_3_GradedVNon extends Action {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
	{
		
		StudentDBModel model = new StudentDBModel();
		String revName;
		ReviewerInfo revInfo = new ReviewerInfo();
		Vector<Application> gradedApps;
		Vector<Application> unGradedApps;
		Vector<ReviewerInfo> reviewerInfos = new Vector<ReviewerInfo>();
		Vector<String> reviewers = new Vector<String>();
		
		reviewers = StudentDBModel.getReviewers();
		
		for(int i = 0; i < reviewers.size(); i++){
			revName = reviewers.elementAt(i);
			gradedApps = model.getGradedApps(revName);
			unGradedApps = model.getUnGradedApps(revName);

			revInfo = new ReviewerInfo( revName, gradedApps, unGradedApps );
			reviewerInfos.add(revInfo);		

		}
		request.setAttribute("reviewers", reviewers);
		request.setAttribute("reviewerInfos", reviewerInfos);
	
		return mapping.findForward("success");

	}

}
